package com.jmb.api.common.enumPro;

public enum AssertType {

    JSON("com/jmb/apiplatform/json", 0),
    HTML("html", 1),
    HEADER("header", 2),
    RESPONSE_CODE("responseCode", 3),
    RUNTIME("runtime", 4),

    //兼容模式
    JSON_("jsonPath", 0),
    JSON__("json_path", 0),
    HTML_("xpath", 1),
    HEADER_("head", 2),
    HEADER__("headers", 2),
    RESPONSE_CODE_("code", 3),
    RESPONSE_CODE__("response_code", 3),
    RUNTIME_("time", 4),;

    private final String assertTypeName;
    private final Integer assertTypeNum;

    public static Integer getAssertTypeKey(String assertTypeName) {
        for(AssertType assertType : AssertType.values()) {
            if (assertType.assertTypeName.equalsIgnoreCase(assertTypeName)) {
                return assertType.assertTypeNum;
            }
        }
        return 0;
    }

    AssertType(String assertTypeName, Integer assertTypeNum) {
        this.assertTypeName = assertTypeName;
        this.assertTypeNum = assertTypeNum;
    }
}
